package io.qar.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.qar.commons.mybatis.service.impl.CrudServiceImpl;
import io.qar.dao.CfgTrgFtpFileDao;
import io.qar.dto.CfgTrgFtpFileDTO;
import io.qar.entity.CfgTrgFtpFileEntity;
import io.qar.service.CfgTrgFtpFileService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 目标qar文件
 *
 * @author yyyyjinying 
 * @since 3.0 2023-11-03
 */
@Service
public class CfgTrgFtpFileServiceImpl extends CrudServiceImpl<CfgTrgFtpFileDao, CfgTrgFtpFileEntity, CfgTrgFtpFileDTO> implements CfgTrgFtpFileService {

    @Override
    public QueryWrapper<CfgTrgFtpFileEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<CfgTrgFtpFileEntity> wrapper = new QueryWrapper<>();

        String trgIp = (String)params.get("trgIp");
        wrapper.eq(StringUtils.isNotBlank(trgIp), "trg_ip", trgIp);
        String trgPort = (String)params.get("trgPort");
        wrapper.eq(StringUtils.isNotBlank(trgPort), "trg_port", trgPort);
        String trgUsername = (String)params.get("trgUsername");
        wrapper.eq(StringUtils.isNotBlank(trgUsername), "trg_username", trgUsername);
        String trgPassword = (String)params.get("trgPassword");
        wrapper.eq(StringUtils.isNotBlank(trgPassword), "trg_password", trgPassword);
        String filePath = (String)params.get("filePath");
        wrapper.eq(StringUtils.isNotBlank(filePath), "file_path", filePath);

        return wrapper;
    }


}